<%@page contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>

<script type="text/javascript">
	var form_url = base.contextPath+"/sysmgr/permits/add.do" ;
	$(function() {
		//编辑，加载表单数据
		if($('input[name=id]').val().length > 0) {
			form_url = base.contextPath+"/sysmgr/permits/edit.do" ;
			$.post(base.contextPath+"/sysmgr/permits/get.do", {id:$('input[name=id]').val()}, function(result) {
				console.info($('input[name=id]').val() +"====="+ result.id) ;
				if (result.id != undefined) {
					$('form').form('load', {
						'name' : result.name,
						'remark' : result.remark,
					});
				}
			}, 'json');
		} 
	});
	
	
	//提交表单数据
	var submitNow = function($d, $dg, flag) {
		$.post(form_url, $("#form").form("getData"), function(result) {
			if (result.status) {
				$dg.datagrid('reload');alertify.success(result.msg);$.easyui.loaded();
				if(flag==undefined||flag==false){$d.dialog("close") ;}
			} else {
				$.easyui.loaded();$.messager.alert("错误", result.msg, "error");
			}
		}, 'json');
	};
	
	//验证表单
	var submitForm = function($d, $dg, flag) { 
		if($('#form').form('validate')) {
			$.easyui.loading({ msg: "数据提交中，请稍等..." });
			submitNow($d, $dg, flag) ;
		}
	};
	
	
</script>

<form id="form" class="easyui-form form_container">
	<input type="hidden" name="id" value="${id}" />
	<input type="hidden" name="modifyName" value="${USER_SESSION.truename}" />
	<table class="tableform">
		<tr>
			<th>权限组名称：</th>
			<td><input name="name" class="easyui-validatebox" type="text" /></td>
		</tr>
		<tr>
			<th>权限组备注：</th>
			<td><input name="remark" class="easyui-validatebox" type="text" /></td>
		</tr>
	</table>
</form>
